import {
	connect
} from 'react-redux';
import Link from '../components/Link';
import {
	setVisibilityFilter
} from '../actions';

const mapStateToProps = (state, ownProps) => ({
	active: state.visibilityFilter === ownProps.filter
})
const mapDispatchToProps = (dispatch, ownProps) => ({
	onClick: (e, active) => {
		if (active) return;
		console.log(e.target);
		dispatch(setVisibilityFilter(ownProps.filter))
	}
})

export default connect(mapStateToProps, mapDispatchToProps)(Link)